/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Ventanas;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author USUARIO
 */
public class panotrosdatoscliente extends javax.swing.JPanel {
String nombreCliente="";
    /**
     * Creates new form panotrosdatoscliente
     */
    public panotrosdatoscliente() {
        initComponents();
    }

    public void setNombreCliente(String nombreCliente) {
        this.nombreCliente = nombreCliente;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnAgregarPizzasFavoritas = new javax.swing.JButton();
        txbtel = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        lblhelado = new javax.swing.JLabel();
        lbltel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblmostrar = new javax.swing.JTable();
        btnsalir = new javax.swing.JButton();
        btnguardar = new javax.swing.JButton();
        lblnombre = new javax.swing.JLabel();
        txbNombre = new javax.swing.JTextField();

        setBackground(new java.awt.Color(253, 245, 224));
        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnAgregarPizzasFavoritas.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btnAgregarPizzasFavoritas.setForeground(new java.awt.Color(102, 51, 255));
        btnAgregarPizzasFavoritas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/choko_crema.png"))); // NOI18N
        btnAgregarPizzasFavoritas.setText("Agregar");
        btnAgregarPizzasFavoritas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnAgregarPizzasFavoritasMouseClicked(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "helado 1", "helado 2" }));

        lblhelado.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblhelado.setForeground(new java.awt.Color(102, 51, 255));
        lblhelado.setText("Helados Favoritos");

        lbltel.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lbltel.setForeground(new java.awt.Color(102, 51, 255));
        lbltel.setText("Telefono");

        tblmostrar.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Nombre", "Telefono(s)", "Helados Favoritos"
            }
        ));
        jScrollPane1.setViewportView(tblmostrar);

        btnsalir.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btnsalir.setForeground(new java.awt.Color(102, 51, 255));
        btnsalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cream_choco.png"))); // NOI18N
        btnsalir.setText("Salir");
        btnsalir.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnsalirMouseClicked(evt);
            }
        });

        btnguardar.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btnguardar.setForeground(new java.awt.Color(102, 51, 255));
        btnguardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cream1.png"))); // NOI18N
        btnguardar.setText("Guardar");
        btnguardar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnguardarMouseClicked(evt);
            }
        });

        lblnombre.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblnombre.setForeground(new java.awt.Color(102, 51, 255));
        lblnombre.setText("Nombre");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(lblnombre)
                        .addGap(80, 80, 80)
                        .addComponent(txbNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 293, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(btnsalir)
                        .addGap(32, 32, 32)
                        .addComponent(btnguardar))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbltel)
                            .addComponent(lblhelado))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(15, 15, 15)
                                .addComponent(txbtel, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(29, 29, 29)
                        .addComponent(btnAgregarPizzasFavoritas, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(62, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(lblnombre))
                    .addComponent(txbNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(9, 9, 9)
                                .addComponent(lbltel))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txbtel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(55, 55, 55))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAgregarPizzasFavoritas)
                        .addGap(8, 8, 8)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblhelado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnsalir)
                    .addComponent(btnguardar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getAccessibleContext().setAccessibleParent(this);
    }// </editor-fold>//GEN-END:initComponents

    private void btnAgregarPizzasFavoritasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnAgregarPizzasFavoritasMouseClicked
        // TODO add your handling code here:
        Object[] fila= new Object[3];
        fila[0]=txbNombre.getText();
        fila[1]=txbtel.getText();
        if(jComboBox1.getSelectedIndex()==-1){
            fila[2]="";
        }else{
            fila[2]=jComboBox1.getSelectedItem().toString();
        }
        DefaultTableModel modelo = (DefaultTableModel)tblmostrar.getModel();
        modelo.addRow(fila);
    }//GEN-LAST:event_btnAgregarPizzasFavoritasMouseClicked

    private void btnsalirMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnsalirMouseClicked
        this.removeAll(); 
        this.updateUI();
        // TODO add your handling code here:
    }//GEN-LAST:event_btnsalirMouseClicked

    private void btnguardarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnguardarMouseClicked
        // TODO add your handling code here:
        if(txbtel.getText().equals("") | jComboBox1.getSelectedIndex()==-1)
        JOptionPane.showMessageDialog(this,"Faltan datos");
        else{
            JOptionPane.showMessageDialog(this,"Guardado");
        }
    }//GEN-LAST:event_btnguardarMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgregarPizzasFavoritas;
    private javax.swing.JButton btnguardar;
    private javax.swing.JButton btnsalir;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblhelado;
    private javax.swing.JLabel lblnombre;
    private javax.swing.JLabel lbltel;
    private javax.swing.JTable tblmostrar;
    private javax.swing.JTextField txbNombre;
    private javax.swing.JTextField txbtel;
    // End of variables declaration//GEN-END:variables
}
